<template>
    <div>
        <div class="i-layout-page-header">
            <PageHeader title="基本信息" hidden-breadcrumb/>
        </div>
        <Card :bordered="false" dis-hover class="ivu-mt i-table-no-border">
            <DescriptionList title="基本信息" :col="1">
                <Description term="申请人姓名">{{data.users[0].nickName}}</Description>
                <Description term="申请人电话：">{{data.users[0].phonenumber}}</Description>
                <Description term="用印文件名：">{{data.adtrtName}}</Description>
                <Description term="文件份数：">{{data.adtrtCount}}</Description>
                <Description term="加盖印章类型：">
                    <span v-if="data.zhangType === '1'">公章</span>
                    <span v-if="data.zhangType === '2'">合同章</span>
                    <span v-if="data.zhangType === '3'">其他</span>
                </Description>
                <Description term="用印原因：">{{data.adtrtReson}}</Description>
                <Description term="申请时间：">{{data.addTime}}</Description>
            </DescriptionList>
        </Card>
    </div>
</template>
<script>
    import Administrative from "@/api/Administrative";

    export default {
        data() {
            return {
                data: ''
            }
        },
        created() {
            this.getDtail();
        },
        methods: {
            // T和Z时间转换
            changeDate(oldDate) {
                var dateee = new Date(oldDate).toJSON();//这个ie不兼容，会返回1970年的时间
                var date = new Date(+new Date(dateee) + 8 * 3600 * 1000)
                    .toISOString()
                    .replace(/T/g, " ")
                    .replace(/\.[\d]{3}Z/, "");
                return date;
                /*this.data.startTime = this.changeDate(res.startTime)
                this.data.endTime = this.changeDate(res.endTime)*/
            },
            getDtail() {
                Administrative.getInfoById({
                    adtrtId: this.$route.query.adtrtId
                })
                    .then(res => {
                        console.log(res.adtrtName);
                        // 返回数据
                        this.data = res;
                        this.data.startTime = this.changeDate(res.startTime)
                        this.data.endTime = this.changeDate(res.endTime)

                    })
                    .catch(err => {
                        // 异常情况
                    })
            }
        }
    }
</script>
